package com.qf.erp_system_admin.controller;

import com.qf.erp_system_admin.entity.Power;
import com.qf.erp_system_admin.entity.User;
import com.qf.erp_system_admin.service.PowerService;
import com.qf.erp_system_admin.util.R;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * @author baishi Li
 * @date
 * @desc
 */
@RestController
@RequestMapping("/power")
@CrossOrigin
public class PowerController {
    private Logger logger = LogManager.getLogger(PowerController.class);
    @Autowired
    private PowerService service;
    @GetMapping("/findAll")
    public R findAll(){
        List<Power> info =  service.findAll();
        return R.ok(20000,"成功",info);
    }
    @GetMapping("/findOnePower")
    public R findOnePower(@RequestParam int pwId){
        Power result = service.findOnePower(pwId);
        return R.ok(20000,"success",result);
    }
}
